
'use strict';

module.exports = app => {
  const mongoose = app.mongoose;
  const Schema = mongoose.Schema;

  const CacheSchema = new Schema({
    key: { type: String },
    value: { type: Schema.Types.Mixed },
    deleted: { type: Boolean, default: false },
    update_at: { type: Date, default: Date.now },
    expired_at: { type: Date },
    create_at: { type: Date, default: Date.now },
  });

  CacheSchema.index({ key: 1 });
  return mongoose.model('CacheSchema', CacheSchema);
};
